package com.example.heimashop.model;

import java.util.List;

/**
 * 订单实体类
 */
public class Order {
    private int id;
    private String orderNo;          // 订单号
    private String consignee;        // 收货人
    private String phone;            // 电话
    private String address;          // 收货地址
    private double totalPrice;       // 总价
    private String status;           // 订单状态：wait_pay, wait_send, wait_receive, completed, cancelled
    private long createTime;         // 创建时间
    private List<OrderGoods> goodsList; // 商品列表（不存数据库，用于显示）

    public Order() {
    }

    public Order(String orderNo, String consignee, String phone, String address,
                 double totalPrice, String status, long createTime) {
        this.orderNo = orderNo;
        this.consignee = consignee;
        this.phone = phone;
        this.address = address;
        this.totalPrice = totalPrice;
        this.status = status;
        this.createTime = createTime;
    }

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public String getOrderNo() {
        return orderNo;
    }

    public void setOrderNo(String orderNo) {
        this.orderNo = orderNo;
    }

    public String getConsignee() {
        return consignee;
    }

    public void setConsignee(String consignee) {
        this.consignee = consignee;
    }

    public String getPhone() {
        return phone;
    }

    public void setPhone(String phone) {
        this.phone = phone;
    }

    public String getAddress() {
        return address;
    }

    public void setAddress(String address) {
        this.address = address;
    }

    public double getTotalPrice() {
        return totalPrice;
    }

    public void setTotalPrice(double totalPrice) {
        this.totalPrice = totalPrice;
    }

    public String getStatus() {
        return status;
    }

    public void setStatus(String status) {
        this.status = status;
    }

    public long getCreateTime() {
        return createTime;
    }

    public void setCreateTime(long createTime) {
        this.createTime = createTime;
    }

    public List<OrderGoods> getGoodsList() {
        return goodsList;
    }

    public void setGoodsList(List<OrderGoods> goodsList) {
        this.goodsList = goodsList;
    }

    /**
     * 获取状态文本
     */
    public String getStatusText() {
        switch (status) {
            case "wait_pay":
                return "待支付";
            case "wait_send":
                return "待发货";
            case "wait_receive":
                return "待收货";
            case "completed":
                return "已完成";
            case "cancelled":
                return "已取消";
            default:
                return "未知状态";
        }
    }
}
